<?php
namespace app\api\extra;
/*
 * content : 信息常用类
 * Author  : Songyicong 
 * time    : 2018-05-05 10:17:04 
 * email   : m13726262373@163.com 
 */

 Class Msgstr{

    /** 返回错误信息和错误code status:0表示errmsg，1表示errcode,2表示code */
    public static function getErrorStr($str,$status=0){
        if($status>2 || $status<0){
            return false;
        }
        $data=[
            // 基础
            "SERVER_ERROR"=>["服务器错误",100000,500],
            "OPENID_EMPTY"=>["open_id 为空",100001,403],
            "URL_ILLEGAL"=>["url权限错误",100002,403],
            "OPENID_ILLEGAL"=>["open id 权限不够",100003,403],
            "PARAMS_EMPTY"=>["部分参数不能为空",100004,200],
            "EMAIL_CODE_ERROR"=>["邮箱验证码错误",100005,200],
            "ACCESS_TOKEN_ILLEGAL"=>["access_token访问是非法的",100006,403],
            "IP_ILLEGAL"=>["ip不合法",100007,403],
            "METHOD_ALLOWED"=>["方法不允许",100008,405],
            "SUCCESS" => ["success",0,200],
            // 注册相关
            "EMAIL_ERROR"=>["邮箱错误",100101,200],
            "EMAIL_EXIST"=>["邮箱已存在",100102,200],
            "LOGIN_EXIST"=>["登录账号已存在",100103,200],
            // 登录相关
            "LOGIN_ERROR"=>["用户名错误",100201,200],
            "PASSWORD_ERROR"=>["密码错误",100202,200],
            "EMAIL_UNEXIST"=>["邮箱不存在",100204,200],
            "EMPTY_UNVALIDATE"=>["邮箱未验证",100205,200],
        ];
        return $data[$str][$status];
    }
 }